	import javax.swing.*;
	import java.awt.*;
import java.awt.event.*;


public class GUI extends JFrame{

	//define variables
	private JButton button1;
    private JButton button2;
    private JPanel panelButton;
    private JLabel oben;
    private JLabel anzeige;	   
	
	
	
	
	
	public GUI()
    {
        super("JRUNNER");
    }

    public static void main(String[] args)
    {
        GUI window = new GUI();
        window.go();
    }

    public void go(){
    	setSize(700,500);
        setLocation(300,300);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        getContentPane().setLayout(new BorderLayout(5,5));

        //create buttons
        button1 = new JButton("Daten synchronisieren");
        button2 = new JButton("JRunner starten");
      
        button1.addActionListener(new ButtonSynchron());
        button2.addActionListener(new ButtonStart());
        
        //create panels
        panelButton = new JPanel(new GridLayout(1,2));

        //put buttons on the panel
        panelButton.add(button1);
        panelButton.add(button2);
   

        //add a listener to the buttons
        addButtonListener(button1);
        addButtonListener(button2);
      
        
        //create labels
        oben = new JLabel("JRunner 1.0");
        //make label central
        oben.setHorizontalAlignment(JLabel.CENTER); 
        anzeige = new JLabel("Bitte treffen Sie ihre Auswahl");

        //put labels on the frame
        getContentPane().add(BorderLayout.NORTH, oben);
        getContentPane().add(anzeige);

        //put panels on the frame
        getContentPane().add(BorderLayout.WEST, panelButton);

    
        setVisible(true);
        

    }
    private class ButtonSynchron implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent ev) {
			// TODO Auto-generated method stub
			JButton b = (JButton) ev.getSource();
			b.setBackground(Color.GREEN);
		}
    	
    }
    private class ButtonStart implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			
		}
    	
    }
    
    
    private void addButtonListener(JButton b)
    {
        b.addActionListener(new ActionListener() 
        { 
            public void actionPerformed(ActionEvent ae) 
            { 
                eingabe(ae.getActionCommand());   //show the chosen action 
            }
        });
    }

    private void eingabe(String a)
    {
        anzeige.setText(a);
    }   
}


 